package com.ningxun.pagent.bus.service.impl;

import java.util.List;

import com.ningxun.pagent.bus.domain.BaseProtocol;
import com.ningxun.pagent.bus.mapper.BaseProtocolMapper;
import com.ningxun.pagent.bus.service.IBaseProtocolService;
import com.ningxun.pagent.common.core.domain.AjaxResult;
import com.ningxun.pagent.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 政策条款Service业务层处理
 *
 * @author pagent
 * @date 2025-07-12
 */
@Service
public class BaseProtocolServiceImpl implements IBaseProtocolService
{
    @Autowired
    private BaseProtocolMapper baseProtocolMapper;

    /**
     * 查询政策条款
     *
     * @param protocolId 政策条款主键
     * @return 政策条款
     */
    @Override
    public BaseProtocol selectBaseProtocolByProtocolId(Long protocolId)
    {
        return baseProtocolMapper.selectBaseProtocolByProtocolId(protocolId);
    }

    /**
     * 查询政策条款列表
     *
     * @param baseProtocol 政策条款
     * @return 政策条款
     */
    @Override
    public List<BaseProtocol> selectBaseProtocolList(BaseProtocol baseProtocol)
    {
        return baseProtocolMapper.selectBaseProtocolList(baseProtocol);
    }

    /**
     * 新增政策条款
     *
     * @param baseProtocol 政策条款
     * @return 结果
     */
    @Override
    public int insertBaseProtocol(BaseProtocol baseProtocol)
    {
        baseProtocol.setCreateTime(DateUtils.getNowDate());
        return baseProtocolMapper.insertBaseProtocol(baseProtocol);
    }

    /**
     * 修改政策条款
     *
     * @param baseProtocol 政策条款
     * @return 结果
     */
    @Override
    public int updateBaseProtocol(BaseProtocol baseProtocol)
    {
        baseProtocol.setUpdateTime(DateUtils.getNowDate());
        return baseProtocolMapper.updateBaseProtocol(baseProtocol);
    }

    /**
     * 批量删除政策条款
     *
     * @param protocolIds 需要删除的政策条款主键
     * @return 结果
     */
    @Override
    public int deleteBaseProtocolByProtocolIds(Long[] protocolIds)
    {
        return baseProtocolMapper.deleteBaseProtocolByProtocolIds(protocolIds);
    }

    /**
     * 删除政策条款信息
     *
     * @param protocolId 政策条款主键
     * @return 结果
     */
    @Override
    public int deleteBaseProtocolByProtocolId(Long protocolId)
    {
        return baseProtocolMapper.deleteBaseProtocolByProtocolId(protocolId);
    }

    @Override
    public List<BaseProtocol> selectProtocolByType(String protocolType) {
        // 假设 mapper 方法实际应返回 List<BaseProtocol>
        return baseProtocolMapper.selectProtocolByType(protocolType);
    }

}
